export default {
  data() {
    const _this = this
    return {
      tableHeader: [
        {
          label: 'LINK_SEGMENT_NAME',
          prop: 'segmentName',
          fixed: 'left',
          configType: 'default',
          width: 200
        },
        {
          label: 'A_END_REGIONAL_STATION_NAME',
          width: 200,
          prop: 'startStationName'
        },
        {
          label: 'A_END_ROOM_NAME',
          prop: 'startRoomName',
          width: 200
        },
        {
          label: 'ANODE',
          prop: 'startNode.nodeName',
          width: 200
        },
        {
          label: 'INTERMEDIATE_CABLE_NAME',
          prop: 'intermediateCableName',
          width: 200,
          formatter(row) {
            const cableList = []
            row.networkSegmentList &&
              row.networkSegmentList.forEach(i => {
                if (i.cableId) cableList.push(i.cable.cableName)
              })
            return cableList.join()
          }
        },
        {
          label: 'NODE_NUM',
          prop: 'nodeNum',
          formatter(row) {
            return row.networkSegmentList.length - 1
          },
          width: 100
        },
        {
          label: 'Z_END_REGIONAL_STATION_NAME',
          prop: 'endStationName',
          width: 200
        },
        {
          label: 'Z_END_ROOM_NAME',
          prop: 'endRoomName',
          width: 200
        },
        {
          label: 'ZNODE',
          prop: 'endNode.nodeName',
          width: 200
        }
      ],
      linkSegmentHeader: [
        {
          label: 'LINK_SEGMENT_NAME',
          prop: 'segmentName',
          fixed: 'left',
          configType: 'default',
          width: 200
        },
        {
          label: 'A_END_REGIONAL_STATION_NAME',
          width: 200,
          prop: 'startStationName'
        },
        {
          label: 'A_END_ROOM_NAME',
          prop: 'startRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ANODE',
          prop: 'startNode.nodeName',
          width: 200
        },
        {
          label: 'INTERMEDIATE_CABLE_NAME',
          prop: 'routeLength',
          formatter(row) {
            const cableList = []
            row.networkSegmentList &&
              row.networkSegmentList.forEach(i => {
                if (i.cableId) cableList.push(i.cable.cableName)
              })
            return cableList.join()
          },
          width: 200
        },
        {
          label: 'Z_END_REGIONAL_STATION_NAME',
          prop: 'endStationName',
          width: 200
        },
        {
          label: 'Z_END_ROOM_NAME',
          prop: 'endRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ZNODE',
          prop: 'endNode.nodeName',
          width: 200
        },
        {
          label: 'REACHABLE_STATE',
          prop: 'reachName',
          width: 200
        }
      ],
      alarmHeader: [
        {
          label: 'LINK_SEGMENT_NAME',
          prop: 'segmentName',
          fixed: 'left',
          configType: 'default',
          width: 200
        },
        {
          label: 'LINK_LOSS_THRESHOLD',
          prop: 'linkLossSill',
          width: 140
        },
        {
          label: 'AVERAGE_LOSS_THRESHOLD',
          prop: 'avgLossSill',
          width: 160
        },
        {
          label: 'TIP_LENGTH',
          prop: 'endLengthSill',
          width: 140
        },
        {
          label: 'PLUG_LOSS_THRESHOLD',
          prop: 'plugLossSill',
          width: 140
        },
        {
          label: 'EFFECT',
          prop: 'enableSill',
          formatter(row) {
            return row.enableSill ? _this.$t('TAKEEFFECT') : _this.$t('NOINVALID')
          }
        },
        {
          label: 'A_END_REGIONAL_STATION_NAME',
          width: 200,
          prop: 'startStationName'
        },
        {
          label: 'A_END_ROOM_NAME',
          prop: 'startRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ANODE',
          width: 200,
          prop: 'startNode.nodeName'
        },
        {
          label: 'INTERMEDIATE_CABLE_NAME',
          prop: 'routeLength',
          formatter(row) {
            return row.networkSegmentList
              .filter(i => !!i.cable)
              .map(i => i.cable.cableName)
              .join()
          },
          width: 180
        },
        {
          label: 'Z_END_REGIONAL_STATION_NAME',
          prop: 'endStationName',
          width: 200
        },
        {
          label: 'Z_END_ROOM_NAME',
          prop: 'endRoomName',
          width: 200,
          configType: 'extend'
        },
        {
          label: 'ZNODE',
          width: 200,
          prop: 'endNode.nodeName'
        }
      ],
      tableHead: []
    }
  },
  created() {
    if (this.pageName === 'alarm') {
      this.tableHead = this.alarmHeader
    } else if (this.pageName === 'linkSegment') {
      this.tableHead = this.linkSegmentHeader
    } else {
      this.tableHead = this.tableHeader
    }
  },
  methods: {
  }
}
